package gui.requestDetail;


import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Vector;

import model.basics.ClassRoom;
import model.basics.Instructor;
import model.basics.MobileResource;
import model.basics.Request;
import model.basics.Resource;
import model.search.Order;
import model.search.System;
import model.time.IllegalTimeValuesException;
import model.time.InvalidMinutesException;
import model.time.NullParametersReceivedExpeption;
import model.time.TimeFrame;
import model.time.WeeklyTimeFrame;

public class Main {

	/**
	 * @param args
	 */
	
	static System sis;
	
	
	
	public static System getSis() {
		return sis;
	}



	public static void main() throws NullParametersReceivedExpeption, InvalidMinutesException, IllegalTimeValuesException {


		ClassRoom cr1 = new ClassRoom(001, 30, "aula1");
		ClassRoom cr2 = new ClassRoom(002, 25, "aula2");
		List<ClassRoom> crs = new Vector<ClassRoom>();
		
		Resource r1 = new Resource("r1");
		Resource r2 = new Resource("r2");
		Resource r3 = new Resource("r3");
		Resource r4 = new Resource("r4");
		HashMap<Resource, Integer> hmr = new HashMap<Resource, Integer>();
		hmr.put(r1, 12);
		hmr.put(r2, 2);
		hmr.put(r3, 0);
		hmr.put(r4, 45);
		List<Resource> res = new Vector<Resource>();
		res.add(r1);
		res.add(r2);
		res.add(r3);
		res.add(r4);
		
		HashMap<Resource, Integer> generalRes = new HashMap<Resource, Integer>();
		generalRes.put(r1, 22);
		generalRes.put(r2, 22);
		generalRes.put(r3, 40);
		generalRes.put(r4, 55);
		
		
		cr1.changeOperationalStatus(true);
		cr1.setResources(hmr);
		cr2.setResources(new HashMap<Resource, Integer>());
		crs.add(cr2);
		crs.add(cr1);

		
		HashMap<Resource, Integer> hmreq1 = new HashMap<Resource, Integer>();
		hmreq1.put(r1,2);
		hmreq1.put(r2,2);
		hmreq1.put(r4,2);

		HashMap<Resource, Integer> hmreq2 = new HashMap<Resource, Integer>();
		hmreq2.put(r1,2);
		hmreq2.put(r4,2);
		hmreq2.put(r2,4);
		
		Instructor i = new Instructor("i2", 1, 41, "mail1", "i2");
		Instructor i2 = new Instructor("i1", 1, 41, "mail2", "i1");
		Instructor i3 = new Instructor("i3", 1, 41, "mail3", "i3");
		
		
		Calendar mtfca1 = new GregorianCalendar(2010, Calendar.MARCH, 1, 00, 00);
		Calendar mtfcb1 = new GregorianCalendar(2010, Calendar.JULY, 1, 00, 00);
		Calendar mtfta1 = new GregorianCalendar(2010, Calendar.JULY, 1, 9, 00);
		Calendar mtftb1 = new GregorianCalendar(2010, Calendar.JULY, 1, 13, 00);
		String dn1 = "Monday";
		WeeklyTimeFrame wtf1 = new WeeklyTimeFrame(mtfca1,mtfcb1,mtfta1,mtftb1,dn1);
		
		Calendar mtfca2 = new GregorianCalendar(2010, Calendar.MARCH, 1, 00, 00);
		Calendar mtfcb2 = new GregorianCalendar(2010, Calendar.JULY, 1, 00, 00);
		Calendar mtfta2 = new GregorianCalendar(2010, Calendar.JULY, 1, 9, 00);
		Calendar mtftb2 = new GregorianCalendar(2010, Calendar.JULY, 1, 13, 00);
		String dn2 = "Wednesday";
		WeeklyTimeFrame wtf2 = new WeeklyTimeFrame(mtfca2,mtfcb2,mtfta2,mtftb2,dn2);
		
		List<TimeFrame> tf1 = new Vector<TimeFrame>();
		tf1.add(wtf1);
		tf1.add(wtf2);

		Calendar mtfca11 = new GregorianCalendar(2010, Calendar.MARCH, 1, 00, 00);
		Calendar mtfcb11 = new GregorianCalendar(2010, Calendar.JULY, 1, 00, 00);
		Calendar mtfta11 = new GregorianCalendar(2010, Calendar.JULY, 1, 9, 00);
		Calendar mtftb11 = new GregorianCalendar(2010, Calendar.JULY, 1, 13, 00);
		String dn11 = "Monday";
		WeeklyTimeFrame wtf11 = new WeeklyTimeFrame(mtfca11,mtfcb11,mtfta11,mtftb11,dn11);
		
		Calendar mtfca22 = new GregorianCalendar(2010, Calendar.MARCH, 1, 00, 00);
		Calendar mtfcb22 = new GregorianCalendar(2010, Calendar.JULY, 1, 00, 00);
		Calendar mtfta22 = new GregorianCalendar(2010, Calendar.JULY, 1, 11, 00);
		Calendar mtftb22 = new GregorianCalendar(2010, Calendar.JULY, 1, 12, 00);
		String dn22 = "Saturday";
		WeeklyTimeFrame wtf22 = new WeeklyTimeFrame(mtfca22,mtfcb22,mtfta22,mtftb22,dn22);
		
		List<TimeFrame> tf11 = new Vector<TimeFrame>();
		tf11.add(wtf11);
		tf11.add(wtf22);
		
		
		Request req1 = new Request(10, hmreq1, tf11, 1000,i2,"mate");
		req1.setSave(true);
		Request req11 = new Request(5, hmreq1, tf1, 1010,i2,"mate");
		
		Request req2 = new Request(20, hmreq1, tf1, 2000,i,"quim");
		Request req22 = new Request(25, hmreq1,tf1, 2032,i,"quim");
		Request req3 = new Request(30, hmreq2, tf1, 3000,i3,"algebra");
		Request req33 = new Request(39, hmreq2, tf1, 3002,i3,"algebra");
		Request req4 = new Request(30, hmreq1, tf1, 4000,i3,"algebra");
		Request req44 = new Request(39, hmreq2, tf1, 4022,i3,"algebra");
		
		List<Request> lrs = new Vector<Request>();
		lrs.add(req1);
		lrs.add(req11);
		lrs.add(req2);
		lrs.add(req22);
		lrs.add(req3);
		lrs.add(req33);
		lrs.add(req4);
		lrs.add(req44);

		Order o1 = new Order(1, i, "mate", cr1, tf1, req11);
		Order o2 = new Order(2, i, "mate1", cr2, tf1, req22);
		Order o3 = new Order(3, i3, "algebra", cr1, tf1, req33 );
		Order o4 = new Order(4, i3, "algebra", cr1, tf1, req44 );
		List<Order> ords = new Vector<Order>();
		ords.add(o1);
		ords.add(o2);
		ords.add(o3);
		ords.add(o4);
		
		System siss = new System(crs,new HashMap<MobileResource, Integer>(),new Vector<MobileResource>(),generalRes,res,new Vector<Instructor>(),new HashMap<String, String>());

		siss.setRequestTotalGeneralList(lrs);
		siss.setAllOrds(ords);
		sis=siss;
		
		new RequestDetailPanel();
		
		
	}

}
